﻿@using Tau.ViewModels
@model AddEditCategory

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>


@using (Html.BeginForm("AddEditCategory", "CategoryAdmin", FormMethod.Post))
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>@( Model.Mode == DisplayMode.Edit ? "Edit Category" : "Add New Category")</legend>

        @Html.HiddenFor(model => model.EditingCategory.CategoryId)

        <table>
            <tr>
                <td>
                    @Html.LabelFor(model => model.EditingCategory.CategoryName)
                </td>
                <td>
                    @Html.EditorFor(model => model.EditingCategory.CategoryName)
                    @Html.ValidationMessageFor(model => model.EditingCategory.CategoryName)
                </td>
            </tr>
        </table>
     
        <p>
            <input type="submit" value="save" />
        </p>
    </fieldset>
}